<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title th:text="${course.title}">课程详情</title>
    <style>
        .module { margin: 24px 0; padding: 16px; border: 1px solid #eee; border-radius: 6px; }
        .content-item { margin: 12px 0; }
        video { display: block; margin-top: 8px; max-width: 100%; }
    </style>
</head>
<body>
    <a href="/courses" style="display:inline-block;margin-bottom:16px;padding:6px 16px;background:#eee;color:#333;border-radius:4px;text-decoration:none;">返回课程列表</a>
    <h2 th:text="${course.title}"></h2>
    <div th:text="${course.description}"></div>
    <div th:each="module : ${course.modules}" class="module">
        <h3 th:text="${module.title}"></h3>
        <div th:text="${module.description}"></div>
        <ul>
            <li th:each="content : ${module.contents}" class="content-item">
                <span th:text="${content.title}"></span>
                <span th:if="${content.type.name() == 'VIDEO'}">
                    <a th:href="${content.contentUrl}" target="_blank" style="color:#1677ff; margin-left:8px;">新窗口播放视频</a>
                </span>
                <span th:if="${content.type.name() == 'DOCUMENT'}">
                    <a th:href="${content.contentUrl}" target="_blank" style="color:#1677ff; margin-left:8px;">下载/阅读文档</a>
                </span>
                <span th:if="${content.type.name() == 'QUIZ'}">
                    <a th:href="@{'/test?contentId=' + ${content.id}}" style="color:#1677ff;">开始测验</a>
                </span>
                <span th:if="${content.type.name() == 'ASSIGNMENT'}">
                    <a th:href="@{'/assignment?contentId=' + ${content.id}}" style="color:#1677ff;">查看作业</a>
                </span>
            </li>
        </ul>
    </div>
    <a href="/courses" style="display:inline-block;margin-top:16px;padding:6px 16px;background:#eee;color:#333;border-radius:4px;text-decoration:none;">返回课程列表</a>
</body>
</html> 